package com.shengyuan.manage_os.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

import com.diegocarloslima.fgelv.lib.FloatingGroupExpandableListView;
import com.diegocarloslima.fgelv.lib.WrapperExpandableListAdapter;
import com.shengyuan.manage_os.R;
import com.shengyuan.manage_os.adapter.EmployeeAdapter;
import com.shengyuan.manage_os.adapter.SampleAdapter;
import com.shengyuan.manage_os.im.ui.ECSuperActivity;
import com.shengyuan.manage_os.sqlite.SQLiteTools;
import com.shengyuan.manage_os.view.MyListView;

import java.util.ArrayList;
import java.util.List;

import oa.database.bean.Employee;

/**
 * Created by Administrator on 2016/11/22.
 */

public class ContactListActivity extends ECSuperActivity {

//    private ListView  listView;
    private List<Employee> employees  = new ArrayList<>();
//    private UserAdapter adapter;
//
//    private List<Friends> friends = new ArrayList<>();
//    private Employee employee;
//    private List<Department> departments = new ArrayList<>();
//    private RelativeLayout img_tab;
//    private TextView tv_tab;
//    private ImageView imageView1,imageView2;
    private boolean isUsual;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //设置状态栏为透明
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        Intent intent = getIntent();
        String title = intent.getStringExtra("title");
        isUsual = intent.getBooleanExtra("isUsual",false);
        getTopBarView().setTopBarToStatus(1, R.drawable.topbar_back_bt,
                -1, null,
                "",
                title, null, this);
        employees = SQLiteTools.queryWhereEmployee(true);
//        img_tab = (RelativeLayout)findViewById(R.id.img_tab);
//        tv_tab = (TextView)findViewById(R.id.tv_tab);
//        imageView1 = (ImageView)findViewById(R.id.img_call);
//        imageView2 = (ImageView)findViewById(R.id.img_notice);

        MyListView listView = (MyListView) findViewById(R.id.usual_list);
        final FloatingGroupExpandableListView list = (FloatingGroupExpandableListView) findViewById(R.id.sample_activity_list);
        if(isUsual){
            listView.setVisibility(View.VISIBLE);
            list.setVisibility(View.GONE);
            listView.setAdapter(new EmployeeAdapter(this,employees));
        }else {
            list.setVisibility(View.VISIBLE);
            listView.setVisibility(View.GONE);
            final SampleAdapter adapter = new SampleAdapter(this,SQLiteTools.queryDepartmentS());
            final WrapperExpandableListAdapter wrapperAdapter = new WrapperExpandableListAdapter(adapter);
            list.setAdapter(wrapperAdapter);
        }



    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_contact_list;
    }


}
